<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head th:replace="fragments/head :: commonHead('项目成员管理')">
    <!-- 页面特定样式将由head.html中的通用头部替代 -->
</head>
<body class="bg-light">
    <div class="container py-5">
        <div class="row mb-4">
            <div class="col">
                <div class="d-flex justify-content-between align-items-center flex-wrap">
                    <div>
                        <h2 class="fw-bold text-primary mb-2">项目成员管理</h2>
                        <nav aria-label="breadcrumb">
                            <ol class="breadcrumb mb-0">
                                <li class="breadcrumb-item"><a th:href="@{/}" class="text-decoration-none">首页</a></li>
                                <li class="breadcrumb-item"><a th:href="@{/project/list}" class="text-decoration-none">项目列表</a></li>
                                <li class="breadcrumb-item active" aria-current="page">成员管理</li>
                            </ol>
                        </nav>
                    </div>
                    <div class="mt-3 mt-md-0">
                        <a th:href="@{/}" class="btn btn-outline-primary">
                            <i class="fas fa-home me-1"></i> 返回首页
                        </a>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row mb-4">
            <div class="col-lg-8 mb-4 mb-lg-0">
                <div class="card border-0 shadow-sm rounded-3 overflow-hidden">
                    <div class="card-header bg-white py-3">
                        <h5 class="mb-0 text-primary">
                            <i class="fas fa-project-diagram me-2"></i>选择项目管理成员
                        </h5>
                    </div>
                    <div class="card-body p-0">
                        <div class="table-responsive">
                            <table class="table table-hover mb-0">
                                <thead class="bg-light">
                                    <tr>
                                        <th class="ps-4">项目ID</th>
                                        <th>项目名称</th>
                                        <th>项目经理</th>
                                        <th class="text-center">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr th:if="${projects.empty}">
                                        <td colspan="4" class="text-center py-4">暂无项目数据</td>
                                    </tr>
                                    <tr th:each="project : ${projects}">
                                        <td class="ps-4" th:text="${project.id}"></td>
                                        <td th:text="${project.name}"></td>
                                        <td th:text="${project.managerName != null ? project.managerName : '未指定'}"></td>
                                        <td class="text-center">
                                            <a th:href="@{/project-member/list/{id}(id=${project.id})}" class="btn btn-primary btn-sm">
                                                <i class="fas fa-users me-1"></i> 管理成员
                                            </a>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="col-lg-4">
                <div class="card border-0 shadow-sm rounded-3 overflow-hidden">
                    <div class="card-header bg-white py-3">
                        <h5 class="mb-0 text-primary">
                            <i class="fas fa-tools me-2"></i>成员管理操作
                        </h5>
                    </div>
                    <div class="card-body">
                        <div class="d-grid gap-3">
                            <a th:href="@{/project-member/add}" class="btn btn-success">
                                <i class="fas fa-user-plus me-2"></i> 添加项目成员
                            </a>
                            <a th:href="@{/project/list}" class="btn btn-outline-primary">
                                <i class="fas fa-list me-2"></i> 查看项目列表
                            </a>
                            <a th:href="@{/user/list}" class="btn btn-outline-secondary" sec:authorize="hasRole('ADMIN')">
                                <i class="fas fa-users-cog me-2"></i> 用户管理
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <footer class="footer mt-auto py-4 bg-dark text-white">
        <div class="container text-center">
            <span>© 2025 项目风险管理系统 | 版本 1.0</span>
        </div>
    </footer>
</body>
</html> 